home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 07 - 1991 / 07.02 Feb 91 / xserial source ƒ / xtest.c < prev   
Encoding:
C/C++ Source or Header  |  1990-07-28  |  1.5 KB  |  73 lines  |  [TEXT/MSWD]

  1. #include     "xcmd.h"
  2. #include    <FileMgr.h>
  3. #include    <MacTypes.h>
  4. #include    <string.h>
  5. #include    <MemoryMgr.h>
  6. #ifdef XTEST
  7. #include    <stdio.h>
  8. #endif
  9. /* this is the main program for the xcmd test jig
  10.  * it defines the parameter block (for both HyperCard and FoxBase)
  11.  * initializes it, sets up parameters and calls the xcmd
  12.  */
  13.  
  14.  
  15. #ifdef XTEST
  16. /* prototype for xcmd under test */
  17. pascal void xserial(XCmdBlock *);
  18.  
  19. main()
  20. {
  21.     XCmdBlock    b;
  22.     XCmdBlock    *pb;
  23.     
  24.     printf("\nStarting XCMD Test");
  25.     
  26.     pb = &b;
  27.     
  28.     /* initialize the xcmd block. THIS MUST BE DONE BEFORE ANY USE
  29.      * OF THE BLOCK
  30.      */
  31.     xinit(pb);
  32.  
  33.     /* call xpars to set the xcmd's parameters prior to each call. 
  34.      * all parameters are strings. there can be 0 to 16 parameters.
  35.      * xpars accepts a variable number of parameters; the last parameter
  36.      * must be an empty string to terminate the list.
  37.      */
  38.     xpars(pb,"1","1200","N","8","1","S","R","");
  39.     xserial(pb);
  40.     printf("\n return value %s",*(pb->returnValue));
  41.     wait(1);
  42.     
  43.     xpars(pb,"ATZ\r","");
  44.     xserial(pb);
  45.     printf("\n ATZ return value %s",*(pb->returnValue));
  46.  
  47.     wait(1);
  48.     xpars(pb,"");
  49.     xserial(pb);
  50.     printf("\n return value %s",*(pb->returnValue));
  51.  
  52.     xpars(pb,"");
  53.     xserial(pb);
  54.     printf("\n return value %s",*(pb->returnValue));
  55.  
  56.     xpars(pb,"ATDP8231770\r","");
  57.     xserial(pb);
  58.     printf("\n DIAL return value %s",*(pb->returnValue));
  59.  
  60.     wait(30); /* wait for 30 seconds after dialing */
  61.     xpars(pb,"");
  62.     xserial(pb);
  63.     printf("\n return value %s",*(pb->returnValue));
  64.  
  65.     xpars(pb,"");
  66.     xserial(pb);
  67.     printf("\n return value %s",*(pb->returnValue));
  68.  
  69.  
  70. }    
  71.  
  72. #endif
  73.